/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.lujotar.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author RamiroHenao
 */
@Entity
@Table(name = "canjeos")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Canjeo.findAll", query = "SELECT c FROM Canjeo c"),
    @NamedQuery(name = "Canjeo.findById", query = "SELECT c FROM Canjeo c WHERE c.id = :id"),
    @NamedQuery(name = "Canjeo.findByPuntos", query = "SELECT c FROM Canjeo c WHERE c.puntos = :puntos"),
    @NamedQuery(name = "Canjeo.findByTarjeta", query = "SELECT c FROM Canjeo c WHERE c.idTarjeta = :id_tarjeta")
})
public class Canjeo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "puntos")
    private Integer puntos;
    @JoinColumn(name = "id_tarjeta", referencedColumnName = "id")
    @ManyToOne
    private Tarjeta idTarjeta;
    @JoinColumn(name = "id_premio", referencedColumnName = "id")
    @ManyToOne
    private Premio idPremio;

    public Canjeo() {
    }

    public Canjeo(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getPuntos() {
        return puntos;
    }

    public void setPuntos(Integer puntos) {
        this.puntos = puntos;
    }

    public Tarjeta getIdTarjeta() {
        return idTarjeta;
    }

    public void setIdTarjeta(Tarjeta idTarjeta) {
        this.idTarjeta = idTarjeta;
    }

    public Premio getIdPremio() {
        return idPremio;
    }

    public void setIdPremio(Premio idPremio) {
        this.idPremio = idPremio;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Canjeo)) {
            return false;
        }
        Canjeo other = (Canjeo) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.lujotar.entities.Canjeo[ id=" + id + " ]";
    }
    
}
